package com.liveMobile.Screen.recorder;

import android.app.Activity;
import android.content.Context;
import android.view.Window;

public class ScreenUtils {
    public ScreenUtils() {
    }

    public static int getScreenWidth(Context context) {
        return context.getResources().getDisplayMetrics().widthPixels;
    }

    public static int getScreenHeight(Context context) {
        return context.getResources().getDisplayMetrics().heightPixels;
    }

    public static float getScreenDensity(Context context) {
        return context.getResources().getDisplayMetrics().density;
    }
    public static int getScreenDensityByInt(Context context) {
        return (int) context.getResources().getDisplayMetrics().density;
    }
    public static int getScreenDensityDpi(Context context) {
        return context.getResources().getDisplayMetrics().densityDpi;
    }
    public static int dip2px(Context context, float px) {
        float scale = getScreenDensity(context);
        return (int)(px * scale + 0.5F);
    }

    public static int px2dip(Context context, float pxValue) {
        float scale = getScreenDensity(context);
        return (int)(pxValue / scale + 0.5F);
    }

    public static void setFullScreen(Activity context) {
        int flag = 1024;
        Window myWindow = context.getWindow();
        myWindow.setFlags(flag, flag);
    }
}
